﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DARE
{
    public class CAudioConfig
    {

    #region fields

        private CDare m_dare;
        private string m_audioEnginePath;
        private string m_soundBankPath;
        private string m_waveBankPath;

    #endregion

    #region properties

        public CDare Dare
        {
            get { return m_dare; }
        }

        public string AudioEnginePath
        {
            get { return m_audioEnginePath; }
            set
            {
                if (m_audioEnginePath == null)
                    m_audioEnginePath = m_dare.Config.General.RootDirectory + "/" + value;
                else
                    throw new Exception("Audio engine path can be set only one time !");
            }
        }

        public string SoundBankPath
        {
            get { return m_soundBankPath; }
            set 
            {
                if (m_soundBankPath == null)
                    m_soundBankPath = m_dare.Config.General.RootDirectory + "/" + value;
                else
                    throw new Exception("Soundbank path can be set only one time !");
            }
        }

        public string WaveBankPath
        {
            get { return m_waveBankPath; }
            set 
            {
                if (m_waveBankPath == null)
                    m_waveBankPath = m_dare.Config.General.RootDirectory + "/" + value;
                else
                    throw new Exception("Wavebank path can be set only one time !");
            }
        }

        public bool PathFilled
        {
            get { return (m_audioEnginePath != null && m_soundBankPath != null && m_waveBankPath != null); }
        }

    #endregion

    #region ctor

        public CAudioConfig(CDare dare)
        {
            Initialize(dare);
        }

        private void Initialize(CDare dare)
        {
            m_dare = dare;
            m_audioEnginePath = null;
            m_soundBankPath = null;
            m_waveBankPath = null;
        }

    #endregion

    #region method

        public void SetAudioPath(string audioEnginePath, string soundBankPath, string waveBankPath)
        {
            AudioEnginePath = audioEnginePath;
            SoundBankPath = soundBankPath;
            WaveBankPath = waveBankPath;
        }

        internal void ResetPath()
        {
            m_audioEnginePath = null;
            m_soundBankPath = null;
            m_waveBankPath = null;
        }

    #endregion

    }
}
